package com.deyuanyun.pic.ctrl.controller.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.deyuanyun.pic.common.util.StringUtils;
import com.deyuanyun.pic.common.util.poi.annotation.ExcelWriteColumn;
import com.deyuanyun.pic.ctrl.enumeration.EqptRunningStatedEnum;
import com.deyuanyun.pic.ctrl.enumeration.ExceptionHandlingStateEnum;
import com.deyuanyun.pic.settings.support.utils.BaseCodeUtils;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 *  阴保电源运行记录展示dto
 *  @author axiao(xj08.dream@gmail.com)
 *  @date 2016-09-18
 *  @version 1.0
 *  Histroy: [修改人][时间][描述]
 */
public class RecodeCpPowerDTO {

    private String id;

    /**
     * 设备编号
     */
    @ExcelWriteColumn
    private String customNumber;

    /**
     * 输出电压（V）
     */
    @ExcelWriteColumn
    private BigDecimal outputVoltage;

    /**
     * 输出电流（A）
     */
    @ExcelWriteColumn
    private BigDecimal outputCurrent;

    /**
     * 控制电位（mV）
     */
    @ExcelWriteColumn
    public Long settingPotential;

    /**
     * 通电点电位（mV）
     */
    @ExcelWriteColumn
    public Long metricalPotential;

    /**
     * 运行状态（运行中RUNNING、WRITTEN_OFF已报废、MAINTENANCE维修中、LEAVE_UNUSED闲置中）
     */
    @ExcelWriteColumn
    private String activeStated;

    /**
     * 停机时间_开始
     */
    @ExcelWriteColumn
    private Date downBeginDate;

    /**
     * 停机时间_结束
     */
    @ExcelWriteColumn
    private Date downEndDate;

    /**
     * 停机原因DOWNREASON
     */
    @ExcelWriteColumn
    private String downReason;

    /**
     * 接地和避雷器设施检查维护
     */
    @ExcelWriteColumn
    private String grounding;

    /**
     * 电缆及连接端子检测维护
     */
    @ExcelWriteColumn
    private String connectionCheck;

    /**
     * 仪表校准
     */
    @ExcelWriteColumn
    private String instrumentCalibration;

    /**
     * 年检修记录
     */
    @ExcelWriteColumn
    private String annualRepairRecord;


    /**
     * 是否有异常
     */
    private boolean hasException;

    /**
     * 异常编号（若无异常则为空）PIC_CTRL_RECODE_EXCEPTION.ID_
     */
    private String exceptionId;

    /**
     * 异常记录
     */
    @ExcelWriteColumn
    private String exceptionRecord;

    /**
     * 处理记录
     */
    @ExcelWriteColumn
    private String treatRecord;

    /**
     * 异常状态
     */
    private String exceptionStated;


    /**
     * 记录人（直接存名称）
     */
    @ExcelWriteColumn
    private String recorder;

    /**
     * 记录时间
     */
    @ExcelWriteColumn
    private Date recordTime;

    /**
     * 备注
     */
    @ExcelWriteColumn
    private String remarks;

    private String imagePath; //图片路径，数据库返回使用，前台不需要

    private List<String> imagePaths; //图片路径集合，前台需要的

    @JSONField(serialize = false)
    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public List<String> getImagePaths() {
        if(StringUtils.isNotEmpty(imagePath)) {
            return Arrays.asList(imagePath.split(","));
        }
        return imagePaths;
    }

    public void setImagePaths(List<String> imagePaths) {
        this.imagePaths = imagePaths;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCustomNumber() {
        return customNumber;
    }

    public void setCustomNumber(String customNumber) {
        this.customNumber = customNumber;
    }

    public BigDecimal getOutputVoltage() {
        return outputVoltage;
    }

    public void setOutputVoltage(BigDecimal outputVoltage) {
        this.outputVoltage = outputVoltage;
    }

    public BigDecimal getOutputCurrent() {
        return outputCurrent;
    }

    public void setOutputCurrent(BigDecimal outputCurrent) {
        this.outputCurrent = outputCurrent;
    }

    public Long getSettingPotential() {
        return settingPotential;
    }

    public void setSettingPotential(Long settingPotential) {
        this.settingPotential = settingPotential;
    }

    public Long getMetricalPotential() {
        return metricalPotential;
    }

    public void setMetricalPotential(Long metricalPotential) {
        this.metricalPotential = metricalPotential;
    }

    public String getActiveStated() {
        if(StringUtils.isNotEmpty(activeStated)) {
            return EqptRunningStatedEnum.valueOf(activeStated).getLabel();
        }
        return activeStated;
    }

    public void setActiveStated(String activeStated) {
        this.activeStated = activeStated;
    }

    public Date getDownBeginDate() {
        return downBeginDate;
    }

    public void setDownBeginDate(Date downBeginDate) {
        this.downBeginDate = downBeginDate;
    }

    public Date getDownEndDate() {
        return downEndDate;
    }

    public void setDownEndDate(Date downEndDate) {
        this.downEndDate = downEndDate;
    }

    public String getDownReason() {
        return BaseCodeUtils.getName(downReason);
    }

    public void setDownReason(String downReason) {
        this.downReason = downReason;
    }

    public String getGrounding() {
        return grounding;
    }

    public void setGrounding(String grounding) {
        this.grounding = grounding;
    }

    public String getConnectionCheck() {
        return connectionCheck;
    }

    public void setConnectionCheck(String connectionCheck) {
        this.connectionCheck = connectionCheck;
    }

    public String getInstrumentCalibration() {
        return instrumentCalibration;
    }

    public void setInstrumentCalibration(String instrumentCalibration) {
        this.instrumentCalibration = instrumentCalibration;
    }

    public String getAnnualRepairRecord() {
        return annualRepairRecord;
    }

    public void setAnnualRepairRecord(String annualRepairRecord) {
        this.annualRepairRecord = annualRepairRecord;
    }

    public boolean isHasException() {
        return hasException;
    }

    public void setHasException(boolean hasException) {
        this.hasException = hasException;
    }

    public String getExceptionId() {
        return exceptionId;
    }

    public void setExceptionId(String exceptionId) {
        this.exceptionId = exceptionId;
    }

    public String getExceptionRecord() {
        return exceptionRecord;
    }

    public void setExceptionRecord(String exceptionRecord) {
        this.exceptionRecord = exceptionRecord;
    }

    public String getTreatRecord() {
        return treatRecord;
    }

    public void setTreatRecord(String treatRecord) {
        this.treatRecord = treatRecord;
    }

    public String getExceptionStated() {
        if(StringUtils.isNotEmpty(exceptionStated))
            return ExceptionHandlingStateEnum.valueOf(exceptionStated).getLabel();
        return null;
    }

    public void setExceptionStated(String exceptionStated) {
        this.exceptionStated = exceptionStated;
    }

    public String getRecorder() {
        return recorder;
    }

    public void setRecorder(String recorder) {
        this.recorder = recorder;
    }

    public Date getRecordTime() {
        return recordTime;
    }

    public void setRecordTime(Date recordTime) {
        this.recordTime = recordTime;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
}
